<!DOCTYPE html>
<html lang="ch-CN">
<head>
  <meta charset="UTF-8">
  <title>枚举(x in object)</title>
</head>
<style>
  body {
    width: 100%;
    height: 100vh;
    background-color: wheat;
    font-size: 30px;
    text-decoration: none;
    font-family: "华文楷体";
  }
</style>
<script>
  let obj = {
    name: "小红",
    age: "21",
    gender: "女",
    // 定义的sayName方法
    sayName: function () {
      document.write("姓名："+this.name+"<br>性别："+this.gender);
    }
  }
  // 枚举语法：for (let x in Object){语句}
  for (let x in obj){
    document.write(x+":")
    document.write(obj[x]+"<br>")
  }
</script>
<body>
</body>
</html>